package com.mxpio.erp.common.order.policy;

import java.util.ArrayList;
import java.util.List;

import com.mxpio.erp.common.inventory.service.LotService;
import com.mxpio.erp.common.jpa.model.Notice;
import com.mxpio.erp.common.jpa.model.Order;
import com.mxpio.erp.common.vo.OrderExcuteLineVo;

import lombok.Data;

/**
 * 业务配置
 *
 */
@Data
public class OrderContext {

	public static OrderContext init(Order order) {
		OrderContext context = new OrderContext();
		context.setEntity(order);
		return context;
	}
	
	private OrderExecuteType orderExecuteType;
	
	//业务单据
	private Order entity;
	
	//执行行
	private List<OrderExcuteLineVo> orderExcuteVos;
	
	//通知单类型
	private Class<? extends Notice> noticeClass;
	
	//检验单类型
	private Class<? extends Notice> qualityClass;
	
	//出入类型
	private String accessType;
	
	private String pickingType;
	
	//业务单类型
	private Class<? extends Order> orderClass;
	
	private LotService lotService;
	
	private List<String> errors;
	
	public void addError(String error) {
		if(errors == null) {
			errors = new ArrayList<>();
		}
		errors.add(error);
	}
	
}
